package com.codyy.lib.base.application.di

import com.codyy.lib.base.application.data.ReposService
import com.codyy.lib.base.application.repos.ReposApi
import com.codyy.lib.base.application.repos.repository.ReposRepository
import com.codyy.lib.base.application.repos.viewmodel.ArticleViewModel
import com.codyy.lib.base.application.repos.viewmodel.ReposViewModel
import org.koin.androidx.viewmodel.dsl.viewModel
import org.koin.dsl.module

val viewModelModule = module {
    viewModel { ReposViewModel(get()) }
    viewModel { ArticleViewModel(get()) }
}
val reposModule = module {
    //factory 每次注入时都重新创建一个新的对象
    factory { ReposRepository(get()) }
}

val remoteModule = module {
    //single 单列注入
    single<ReposApi> { ReposService }

}
//val localModule = module {
//    single { userDao }
//}

val appModule = listOf(viewModelModule, reposModule, remoteModule)//, localModule)